import java.io.PrintStream;

public class PrintStreamTest {
    public static void main(String[] args) {
        System.out.println("老骥伏枥");
        System.out.println("志在千里");
        try(
                PrintStream ps=
                        new PrintStream("IO_src/printStream.txt");
                ){
            // 修改系统默认的打印流对象改成自定义
            System.setOut(ps);
            System.out.println("壮士暮年");
            System.out.println("壮心不已");
        }catch(Exception e){
            e.printStackTrace();
        }
    }
}
